import React from "react";
import { useNavigate, Outlet } from "react-router";

export default function Login() {
  const navigate = useNavigate();
  const toFirst = () => {
    // 传参
    navigate('/user',{state: 123, replace: true})// 传递参数保存在state中
  }
  const toAbc = () => {
      navigate('/login/abc',{state: {arr:[1,2,3]}})
  }
  return (
      <div>
        <h2 onClick={toFirst}>我是登录组件</h2>
          <button onClick={toAbc}>to_abc</button>
          {/*OutLet确认子路由的位置*/}
          <Outlet/>
      </div>
  )
}

